aphakia/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
aphakia/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
aphakia/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
aphakia/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
aphakia/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
aphakia/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
aphakia/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
aphakia/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
aphakia/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
aphakia/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
aphakia/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
aphakia/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
aphakia/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
aphakia/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
aphakia/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
aphakia/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
aphakia/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
aphakia/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
aphakia/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
aphakia/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
aphakia/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
aphakia/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
aphakia/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
aphakia/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
aphakia/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
aphakia/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
aphakia/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
aphakia/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
aphakia/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
aphakia/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
aphakia/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
aphakia/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
aphakia/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
aphakia/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
aphakia/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
aphakia/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
aphakia/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
aphakia/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
aphakia/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
aphakia/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
aphakia/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
aphakia/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
ascian/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
ascian/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
ascian/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
ascian/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
ascian/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
ascian/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
ascian/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
ascian/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
ascian/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
ascian/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
ascian/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
ascian/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
ascian/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
ascian/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
ascian/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
ascian/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
ascian/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
ascian/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
ascian/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
ascian/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
ascian/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
ascian/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
ascian/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
ascian/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
ascian/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
ascian/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
ascian/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
ascian/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
ascian/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
ascian/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
ascian/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
ascian/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
ascian/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
ascian/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
ascian/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
ascian/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
ascian/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
ascian/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
ascian/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
ascian/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
ascian/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
ascian/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
bolognese/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
bolognese/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
bolognese/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
bolognese/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
bolognese/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
bolognese/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
bolognese/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
bolognese/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
bolognese/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
bolognese/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
bolognese/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
bolognese/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
bolognese/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
bolognese/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
bolognese/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
bolognese/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
bolognese/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
bolognese/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
bolognese/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
bolognese/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
bolognese/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
bolognese/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
bolognese/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
bolognese/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
bolognese/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
bolognese/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
bolognese/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
bolognese/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
bolognese/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
bolognese/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
bolognese/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
bolognese/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
bolognese/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
bolognese/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
bolognese/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
bolognese/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
bolognese/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
bolognese/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
bolognese/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
bolognese/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
bolognese/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
bolognese/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
breeze/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
breeze/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
breeze/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
breeze/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
breeze/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
breeze/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
breeze/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
breeze/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
breeze/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
breeze/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
breeze/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
breeze/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
breeze/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
breeze/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
breeze/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
breeze/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
breeze/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
breeze/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
breeze/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
breeze/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
breeze/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
breeze/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
breeze/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
breeze/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
breeze/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
breeze/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
breeze/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
breeze/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
breeze/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
breeze/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
breeze/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
breeze/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
breeze/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
breeze/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
breeze/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
breeze/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
breeze/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
breeze/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
breeze/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
breeze/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
breeze/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
breeze/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
celemin/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
celemin/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
celemin/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
celemin/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
celemin/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
celemin/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
celemin/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
celemin/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
celemin/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
celemin/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
celemin/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
celemin/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
celemin/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
celemin/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
celemin/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
celemin/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
celemin/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
celemin/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
celemin/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
celemin/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
celemin/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
celemin/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
celemin/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
celemin/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
celemin/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
celemin/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
celemin/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
celemin/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
celemin/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
celemin/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
celemin/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
celemin/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
celemin/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
celemin/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
celemin/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
celemin/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
celemin/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
celemin/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
celemin/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
celemin/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
celemin/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
celemin/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
coquilla/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
coquilla/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
coquilla/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
coquilla/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
coquilla/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
coquilla/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
coquilla/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
coquilla/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
coquilla/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
coquilla/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
coquilla/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
coquilla/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
coquilla/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
coquilla/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
coquilla/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
coquilla/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
coquilla/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
coquilla/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
coquilla/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
coquilla/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
coquilla/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
coquilla/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
coquilla/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
coquilla/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
coquilla/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
coquilla/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
coquilla/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
coquilla/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
coquilla/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
coquilla/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
coquilla/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
coquilla/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
coquilla/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
coquilla/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
coquilla/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
coquilla/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
coquilla/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
coquilla/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
coquilla/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
coquilla/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
coquilla/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
coquilla/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
filasse/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
filasse/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
filasse/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
filasse/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
filasse/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
filasse/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
filasse/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
filasse/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
filasse/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
filasse/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
filasse/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
filasse/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
filasse/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
filasse/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
filasse/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
filasse/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
filasse/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
filasse/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
filasse/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
filasse/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
filasse/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
filasse/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
filasse/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
filasse/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
filasse/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
filasse/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
filasse/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
filasse/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
filasse/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
filasse/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
filasse/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
filasse/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
filasse/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
filasse/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
filasse/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
filasse/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
filasse/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
filasse/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
filasse/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
filasse/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
filasse/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
filasse/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
gradable/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
gradable/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
gradable/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
gradable/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
gradable/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
gradable/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
gradable/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
gradable/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
gradable/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
gradable/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
gradable/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
gradable/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
gradable/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
gradable/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
gradable/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
gradable/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
gradable/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
gradable/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
gradable/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
gradable/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
gradable/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
gradable/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
gradable/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
gradable/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
gradable/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
gradable/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
gradable/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
gradable/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
gradable/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
gradable/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
gradable/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
gradable/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
gradable/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
gradable/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
gradable/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
gradable/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
gradable/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
gradable/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
gradable/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
gradable/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
gradable/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
gradable/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
harbinger/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
harbinger/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
harbinger/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
harbinger/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
harbinger/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
harbinger/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
harbinger/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
harbinger/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
harbinger/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
harbinger/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
harbinger/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
harbinger/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
harbinger/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
harbinger/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
harbinger/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
harbinger/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
harbinger/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
harbinger/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
harbinger/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
harbinger/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
harbinger/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
harbinger/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
harbinger/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
harbinger/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
harbinger/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
harbinger/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
harbinger/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
harbinger/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
harbinger/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
harbinger/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
harbinger/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
harbinger/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
harbinger/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
harbinger/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
harbinger/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
harbinger/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
harbinger/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
harbinger/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
harbinger/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
harbinger/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
harbinger/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
harbinger/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
kashima/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
kashima/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
kashima/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
kashima/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
kashima/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
kashima/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
kashima/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
kashima/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
kashima/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
kashima/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
kashima/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
kashima/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
kashima/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
kashima/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
kashima/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
kashima/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
kashima/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
kashima/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
kashima/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
kashima/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
kashima/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
kashima/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
kashima/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
kashima/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
kashima/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
kashima/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
kashima/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
kashima/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
kashima/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
kashima/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
kashima/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
kashima/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
kashima/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
kashima/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
kashima/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
kashima/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
kashima/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
kashima/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
kashima/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
kashima/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
kashima/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
kashima/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
knockdown/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
knockdown/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
knockdown/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
knockdown/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
knockdown/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
knockdown/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
knockdown/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
knockdown/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
knockdown/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
knockdown/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
knockdown/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
knockdown/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
knockdown/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
knockdown/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
knockdown/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
knockdown/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
knockdown/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
knockdown/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
knockdown/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
knockdown/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
knockdown/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
knockdown/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
knockdown/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
knockdown/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
knockdown/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
knockdown/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
knockdown/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
knockdown/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
knockdown/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
knockdown/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
knockdown/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
knockdown/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
knockdown/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
knockdown/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
knockdown/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
knockdown/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
knockdown/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
knockdown/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
knockdown/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
knockdown/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
knockdown/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
knockdown/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
manful/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
manful/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
manful/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
manful/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
manful/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
manful/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
manful/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
manful/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
manful/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
manful/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
manful/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
manful/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
manful/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
manful/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
manful/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
manful/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
manful/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
manful/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
manful/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
manful/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
manful/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
manful/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
manful/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
manful/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
manful/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
manful/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
manful/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
manful/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
manful/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
manful/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
manful/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
manful/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
manful/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
manful/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
manful/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
manful/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
manful/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
manful/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
manful/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
manful/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
manful/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
manful/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
maximal/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
maximal/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
maximal/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
maximal/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
maximal/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
maximal/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
maximal/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
maximal/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
maximal/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
maximal/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
maximal/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
maximal/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
maximal/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
maximal/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
maximal/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
maximal/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
maximal/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
maximal/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
maximal/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
maximal/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
maximal/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
maximal/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
maximal/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
maximal/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
maximal/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
maximal/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
maximal/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
maximal/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
maximal/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
maximal/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
maximal/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
maximal/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
maximal/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
maximal/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
maximal/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
maximal/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
maximal/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
maximal/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
maximal/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
maximal/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
maximal/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
maximal/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
periclase/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
periclase/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
periclase/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
periclase/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
periclase/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
periclase/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
periclase/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
periclase/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
periclase/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
periclase/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
periclase/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
periclase/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
periclase/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
periclase/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
periclase/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
periclase/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
periclase/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
periclase/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
periclase/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
periclase/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
periclase/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
periclase/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
periclase/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
periclase/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
periclase/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
periclase/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
periclase/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
periclase/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
periclase/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
periclase/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
periclase/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
periclase/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
periclase/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
periclase/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
periclase/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
periclase/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
periclase/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
periclase/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
periclase/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
periclase/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
periclase/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
periclase/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
poesis/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
poesis/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
poesis/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
poesis/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
poesis/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
poesis/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
poesis/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
poesis/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
poesis/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
poesis/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
poesis/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
poesis/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
poesis/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
poesis/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
poesis/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
poesis/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
poesis/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
poesis/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
poesis/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
poesis/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
poesis/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
poesis/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
poesis/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
poesis/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
poesis/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
poesis/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
poesis/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
poesis/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
poesis/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
poesis/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
poesis/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
poesis/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
poesis/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
poesis/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
poesis/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
poesis/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
poesis/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
poesis/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
poesis/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
poesis/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
poesis/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
poesis/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
proton/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
proton/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
proton/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
proton/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
proton/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
proton/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
proton/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
proton/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
proton/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
proton/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
proton/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
proton/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
proton/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
proton/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
proton/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
proton/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
proton/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
proton/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
proton/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
proton/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
proton/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
proton/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
proton/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
proton/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
proton/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
proton/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
proton/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
proton/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
proton/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
proton/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
proton/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
proton/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
proton/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
proton/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
proton/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
proton/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
proton/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
proton/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
proton/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
proton/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
proton/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
proton/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
recedence/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
recedence/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
recedence/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
recedence/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
recedence/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
recedence/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
recedence/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
recedence/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
recedence/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
recedence/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
recedence/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
recedence/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
recedence/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
recedence/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
recedence/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
recedence/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
recedence/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
recedence/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
recedence/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
recedence/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
recedence/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
recedence/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
recedence/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
recedence/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
recedence/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
recedence/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
recedence/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
recedence/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
recedence/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
recedence/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
recedence/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
recedence/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
recedence/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
recedence/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
recedence/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
recedence/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
recedence/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
recedence/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
recedence/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
recedence/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
recedence/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
recedence/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
scram/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
scram/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
scram/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
scram/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
scram/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
scram/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
scram/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
scram/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
scram/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
scram/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
scram/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
scram/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
scram/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
scram/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
scram/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
scram/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
scram/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
scram/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
scram/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
scram/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
scram/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
scram/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
scram/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
scram/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
scram/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
scram/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
scram/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
scram/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
scram/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
scram/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
scram/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
scram/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
scram/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
scram/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
scram/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
scram/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
scram/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
scram/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
scram/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
scram/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
scram/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
scram/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
server/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
server/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
server/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
server/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
server/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
server/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
server/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
server/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
server/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
server/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
server/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
server/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
server/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
server/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
server/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
server/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
server/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
server/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
server/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
server/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
server/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
server/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
server/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
server/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
server/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
server/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
server/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
server/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
server/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
server/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
server/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
server/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
server/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
server/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
server/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
server/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
server/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
server/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
server/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
server/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
server/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
server/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
shrubbish/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
shrubbish/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
shrubbish/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
shrubbish/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
shrubbish/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
shrubbish/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
shrubbish/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
shrubbish/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
shrubbish/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
shrubbish/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
shrubbish/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
shrubbish/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
shrubbish/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
shrubbish/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
shrubbish/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
shrubbish/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
shrubbish/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
shrubbish/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
shrubbish/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
shrubbish/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
shrubbish/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
shrubbish/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
shrubbish/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
shrubbish/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
shrubbish/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
shrubbish/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
shrubbish/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
shrubbish/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
shrubbish/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
shrubbish/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
shrubbish/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
shrubbish/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
shrubbish/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
shrubbish/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
shrubbish/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
shrubbish/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
shrubbish/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
shrubbish/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
shrubbish/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
shrubbish/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
shrubbish/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
shrubbish/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
sultam/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
sultam/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
sultam/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
sultam/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
sultam/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
sultam/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
sultam/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
sultam/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
sultam/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
sultam/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
sultam/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
sultam/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
sultam/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
sultam/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
sultam/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
sultam/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
sultam/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
sultam/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
sultam/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
sultam/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
sultam/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
sultam/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
sultam/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
sultam/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
sultam/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
sultam/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
sultam/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
sultam/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
sultam/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
sultam/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
sultam/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
sultam/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
sultam/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
sultam/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
sultam/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
sultam/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
sultam/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
sultam/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
sultam/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
sultam/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
sultam/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
sultam/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
virtuoso/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
virtuoso/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
virtuoso/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
virtuoso/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
virtuoso/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
virtuoso/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
virtuoso/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
virtuoso/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
virtuoso/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
virtuoso/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
virtuoso/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
virtuoso/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
virtuoso/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
virtuoso/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
virtuoso/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
virtuoso/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
virtuoso/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
virtuoso/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
virtuoso/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
virtuoso/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
virtuoso/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
virtuoso/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
virtuoso/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
virtuoso/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
virtuoso/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
virtuoso/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
virtuoso/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
virtuoso/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
virtuoso/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
virtuoso/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
virtuoso/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
virtuoso/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
virtuoso/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
virtuoso/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
virtuoso/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
virtuoso/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
virtuoso/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
virtuoso/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
virtuoso/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
virtuoso/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
virtuoso/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
virtuoso/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
wherrit/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
wherrit/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
wherrit/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
wherrit/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
wherrit/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
wherrit/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
wherrit/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
wherrit/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
wherrit/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
wherrit/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
wherrit/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wherrit/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wherrit/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
wherrit/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
wherrit/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
wherrit/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
wherrit/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
wherrit/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
wherrit/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
wherrit/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
wherrit/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
wherrit/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
wherrit/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
wherrit/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
wherrit/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
wherrit/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
wherrit/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
wherrit/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
wherrit/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
wherrit/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
wherrit/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
wherrit/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
wherrit/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
wherrit/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
wherrit/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
wherrit/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
wherrit/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
wherrit/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
wherrit/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
wherrit/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
wherrit/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
wherrit/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
winsome/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
winsome/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
winsome/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
winsome/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
winsome/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
winsome/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
winsome/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
winsome/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
winsome/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
winsome/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
winsome/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
winsome/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
winsome/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
winsome/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
winsome/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
winsome/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
winsome/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
winsome/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
winsome/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
winsome/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
winsome/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
winsome/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
winsome/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
winsome/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
winsome/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
winsome/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
winsome/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
winsome/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
winsome/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
winsome/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
winsome/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
winsome/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
winsome/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
winsome/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
winsome/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
winsome/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
winsome/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
winsome/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
winsome/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
winsome/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
winsome/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
winsome/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
wirelike/dark
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
wirelike/light
https://github.com/Arkania/TrilliumEMU/tree/master/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.cpp
 1 /*
 2  * Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
 3  *
 4  * Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
 5  *
 6  * Copyright (C) 2011 TrilliumEMU <http://www.trilliumemu.org/>
 7  *
 8  * This program is free software; you can redistribute it and/or modify it
 9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation; either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but WITHOUT
14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16  * more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 /* ContentData
23 npc_prophet_velen
24 npc_captain_selana
25 EndContentData */
26 
27 #include "ScriptPCH.h"
28 #include "sunwell_plateau.h"
29 
30 /*######
31 ## npc_prophet_velen
32 ######*/
33 
34 enum ProphetSpeeches
35 {
36     PROPHET_SAY1 = -1580099,
37     PROPHET_SAY2 = -1580100,
38     PROPHET_SAY3 = -1580101,
39     PROPHET_SAY4 = -1580102,
40     PROPHET_SAY5 = -1580103,
41     PROPHET_SAY6 = -1580104,
42     PROPHET_SAY7 = -1580105,
43     PROPHET_SAY8 = -1580106
44 };
45 
46 enum LiadrinnSpeeches
47 {
48     LIADRIN_SAY1 = -1580107,
49     LIADRIN_SAY2 = -1580108,
50     LIADRIN_SAY3 = -1580109
51 };
52 
53 /*######
54 ## npc_captain_selana
55 ######*/
56 
57 #define CS_GOSSIP1 "Give me a situation report, Captain."
58 #define CS_GOSSIP2 "What went wrong?"
59 #define CS_GOSSIP3 "Why did they stop?"
60 #define CS_GOSSIP4 "Your insight is appreciated."
61 
62 void AddSC_sunwell_plateau()
63 {
64 }
wirelike/dark
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
wirelike/light
https://github.com/mirrors/linux-2.6/tree/master/arch/m68k/hp300/time.c
 1 /*
 2  *  linux/arch/m68k/hp300/time.c
 3  *
 4  *  Copyright (C) 1998 Philip Blundell <philb@gnu.org>
 5  *
 6  *  This file contains the HP300-specific time handling code.
 7  */
 8 
 9 #include <asm/ptrace.h>
10 #include <linux/types.h>
11 #include <linux/init.h>
12 #include <linux/sched.h>
13 #include <linux/kernel_stat.h>
14 #include <linux/interrupt.h>
15 #include <asm/machdep.h>
16 #include <asm/irq.h>
17 #include <asm/io.h>
18 #include <asm/system.h>
19 #include <asm/traps.h>
20 #include <asm/blinken.h>
21 
22 /* Clock hardware definitions */
23 
24 #define CLOCKBASE   0xf05f8000
25 
26 #define CLKCR1      0x1
27 #define CLKCR2      0x3
28 #define CLKCR3      CLKCR1
29 #define CLKSR       CLKCR2
30 #define CLKMSB1     0x5
31 #define CLKMSB2     0x9
32 #define CLKMSB3     0xD
33 
34 /* This is for machines which generate the exact clock. */
35 #define USECS_PER_JIFFY (1000000/HZ)
36 
37 #define INTVAL ((10000 / 4) - 1)
38 
39 static irqreturn_t hp300_tick(int irq, void *dev_id)
40 {
41     unsigned long tmp;
42     irq_handler_t vector = dev_id;
43     in_8(CLOCKBASE + CLKSR);
44     asm volatile ("movpw %1@(5),%0" : "=d" (tmp) : "a" (CLOCKBASE));
45     /* Turn off the network and SCSI leds */
46     blinken_leds(00xe0);
47     return vector(irq, NULL);
48 }
49 
50 unsigned long hp300_gettimeoffset(void)
51 {
52   /* Read current timer 1 value */
53   unsigned char lsb, msb1, msb2;
54   unsigned short ticks;
55 
56   msb1 = in_8(CLOCKBASE + 5);
57   lsb = in_8(CLOCKBASE + 7);
58   msb2 = in_8(CLOCKBASE + 5);
59   if (msb1 != msb2)
60     /* A carry happened while we were reading.  Read it again */
61     lsb = in_8(CLOCKBASE + 7);
62   ticks = INTVAL - ((msb2 << 8) | lsb);
63   return (USECS_PER_JIFFY * ticks) / INTVAL;
64 }
65 
66 void __init hp300_sched_init(irq_handler_t vector)
67 {
68   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
69   out_8(CLOCKBASE + CLKCR1, 0x1);       /* reset */
70 
71   asm volatile(" movpw %0,%1@(5)" : : "d" (INTVAL), "a" (CLOCKBASE));
72 
73   if (request_irq(IRQ_AUTO_6, hp300_tick, IRQ_FLG_STD, "timer tick", vector))
74     pr_err("Couldn't register timer interrupt\n");
75 
76   out_8(CLOCKBASE + CLKCR2, 0x1);       /* select CR1 */
77   out_8(CLOCKBASE + CLKCR1, 0x40);      /* enable irq */
78 }
wirelike/dark
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
wirelike/light
https://github.com/nhibernate/nhibernate-core/tree/master/src/NHibernate.Test/TypesTest/EntityTypeFixture.cs
 1 using NHibernate.Engine;^M
 2 using NHibernate.Type;^M
 3 using NUnit.Framework;^M
 4 ^M
 5 namespace NHibernate.Test.TypesTest^M
 6 {^M
 7     // http://jira.nhibernate.org/browse/NH-1473^M
 8     [TestFixture]^M
 9     public class EntityTypeFixture : TypeFixtureBase^M
10     {^M
11         protected override string TypeName^M
12         {^M
13             get { return "Entity"; }^M
14         }^M
15 ^M
16         [Test]^M
17         public void Compare()^M
18         {^M
19             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
20 ^M
21             EntityClass a = new EntityClass(1);^M
22             EntityClass b = new EntityClass(2);^M
23 ^M
24             EntityClass ca = new ComparableEntityClass(1);^M
25             EntityClass cb = new ComparableEntityClass(2);^M
26 ^M
27             Assert.AreEqual(-1, type.Compare(a, cb, EntityMode.Poco));^M
28             Assert.AreEqual(-1, type.Compare(ca, b, EntityMode.Poco));^M
29             Assert.AreEqual(-1, type.Compare(ca, cb, EntityMode.Poco));^M
30 ^M
31             Assert.AreEqual(1, type.Compare(b, ca, EntityMode.Poco));^M
32             Assert.AreEqual(1, type.Compare(cb, a, EntityMode.Poco));^M
33             Assert.AreEqual(1, type.Compare(cb, ca, EntityMode.Poco));^M
34 ^M
35             Assert.AreEqual(0, type.Compare(ca, a, EntityMode.Poco));^M
36             Assert.AreEqual(0, type.Compare(a, ca, EntityMode.Poco));^M
37         }^M
38 ^M
39         [Test]^M
40         public void Equals()^M
41         {^M
42             EntityType type = (EntityType) NHibernateUtil.Entity(typeof (EntityClass));^M
43 ^M
44             EntityClass a = new EntityClass(1);^M
45             EntityClass b = new EntityClass(2);^M
46             EntityClass c = new EntityClass(1);^M
47 ^M
48             Assert.IsTrue(type.IsEqual(a, a, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
49             Assert.IsFalse(type.IsEqual(a, b, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
50             Assert.IsTrue(type.IsEqual(a, c, EntityMode.Poco, (ISessionFactoryImplementor) sessions));^M
51         }^M
52     }^M
53 }^M
wirelike/dark
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
wirelike/light
https://github.com/torvalds/linux/tree/master/include/net/phonet/pn_dev.h
 1 /*
 2  * File: pn_dev.h
 3  *
 4  * Phonet network device
 5  *
 6  * Copyright (C) 2008 Nokia Corporation.
 7  *
 8  * This program is free software; you can redistribute it and/or
 9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
23 #ifndef PN_DEV_H
24 #define PN_DEV_H
25 
26 struct phonet_device_list {
27     struct list_head list;
28     struct mutex lock;
29 };
30 
31 struct phonet_device_list *phonet_device_list(struct net *net);
32 
33 struct phonet_device {
34     struct list_head list;
35     struct net_device *netdev;
36     DECLARE_BITMAP(addrs, 64);
37     struct rcu_head rcu;
38 };
39 
40 int phonet_device_init(void);
41 void phonet_device_exit(void);
42 int phonet_netlink_register(void);
43 struct net_device *phonet_device_get(struct net *net);
44 
45 int phonet_address_add(struct net_device *dev, u8 addr);
46 int phonet_address_del(struct net_device *dev, u8 addr);
47 u8 phonet_address_get(struct net_device *dev, u8 addr);
48 int phonet_address_lookup(struct net *net, u8 addr);
49 void phonet_address_notify(int event, struct net_device *dev, u8 addr);
50 
51 int phonet_route_add(struct net_device *dev, u8 daddr);
52 int phonet_route_del(struct net_device *dev, u8 daddr);
53 void rtm_phonet_notify(int event, struct net_device *dev, u8 dst);
54 struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr);
55 struct net_device *phonet_route_output(struct net *net, u8 daddr);
56 
57 #define PN_NO_ADDR  0xff
58 
59 extern const struct file_operations pn_sock_seq_fops;
60 extern const struct file_operations pn_res_seq_fops;
61 
62 #endif
wirelike/dark
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
wirelike/light
https://github.com/marijnh/Postmodern/tree/master/postmodern/prepare.lisp
 1 (in-package :postmodern)
 2 
 3 (defun ensure-prepared (connection id query)
 4   "Make sure a statement has been prepared for this connection."
 5   (let ((meta (connection-meta connection)))
 6     (unless (gethash id meta)
 7       (setf (gethash id meta) t)
 8       (prepare-query connection (symbol-name id) query))))
 9 
10 (let ((next-id 0))
11   (defun next-statement-id ()
12     "Provide unique statement names."
13     (incf next-id)
14     (intern (format nil "STATEMENT-~A" next-id) :keyword)))
15 
16 (defun generate-prepared (function-form query format)
17   "Helper macro for the following two functions."
18   (destructuring-bind (reader result-form) (reader-for-format format)
19     (let ((base `(exec-prepared *database* (symbol-name statement-id) params ,reader)))
20       `(let ((statement-id (next-statement-id))
21              (query ,(real-query query)))
22         (,@function-form (&rest params)
23           (ensure-prepared *database* statement-id query)
24          (,result-form ,base))))))
25 
26 (defmacro prepare (query &optional (format :rows))
27   "Wraps a query into a function that will prepare it once for a
28 connection, and then execute it with the given parameters. The query
29 should contain a placeholder \($1, $2, etc) for every parameter."
30   (generate-prepared '(lambda) query format))
31 
32 (defmacro defprepared (name query &optional (format :rows))
33   "Like perpare, but gives the function a name instead of returning
34 it."
35   (generate-prepared `(defun ,name) query format))
36 
37 (defmacro defprepared-with-names (name (&rest args)
38                   (query &rest query-args)
39                   &optional (format :rows))
40   "Like defprepared, but with lambda list for statement arguments."
41   (let ((prepared-name (gensym "STATEMENT")))
42     `(progn
43        (defprepared ,prepared-name ,query ,format)
44        (defun ,name ,args
45      (,prepared-name ,@query-args)))))
wirelike/dark
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wirelike/light
https://github.com/magit/magit/tree/master/contrib/magit-simple-keys.el
 1 ;;; magit-simple-keys.el --- simple keybindings for Magit
 2 
 3 ;; Copyright (C) 2011  Ramkumar Ramachandra
 4 ;;
 5 ;; Magit is free software; you can redistribute it and/or modify it
 6 ;; under the terms of the GNU General Public License as published by
 7 ;; the Free Software Foundation; either version 3, or (at your option)
 8 ;; any later version.
 9 ;;
10 ;; Magit is distributed in the hope that it will be useful, but WITHOUT
11 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 ;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
13 ;; License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with Magit.  If not, see <http://www.gnu.org/licenses/>.
17 
18 ;;; Commentary:
19 
20 ;; This plug-in overrides the keybindings in magit-key-mode with
21 ;; simpler keybindings; it does this by picking the most obviously
22 ;; used command in each key group
23 
24 ;;; Code:
25 
26 (require 'magit)
27 
28 (defvar magit-key-mode-mapping
29   '((logging magit-display-log)
30     (running magit-shell-command)
31     (fetching magit-fetch-current)
32     (pushing magit-push)
33     (pulling magit-pull)
34     (branching magit-checkout)
35     (tagging magit-tag)
36     (stashing magit-stash)
37     (merging magit-merge)
38     (submodule magit-submodule-update)))
39 
40 (defun magit-key-mode-generate (term mapping-function)
41   "Generate alias for the key-group term"
42   (eval
43    `(defalias ',(intern (concat "magit-key-mode-popup-" (symbol-name term)))
44     mapping-function)))
45 
46 ;; generate the aliases using the mapping in key-mode-mapping
47 (mapc (lambda (g)
48         (magit-key-mode-generate (car g) (cadr g)))
49       magit-key-mode-mapping)
50 
51 (provide 'magit-simple-keys)
52 ;;; magit-simple-keys.el ends here
wirelike/dark
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
wirelike/light
https://github.com/erlang/otp/tree/master/lib/ic/examples/pre_post_condition/tracer.erl
 1 %%
 2 %% %CopyrightBegin%
 3 %% 
 4 %% Copyright Ericsson AB 1999-2009. All Rights Reserved.
 5 %% 
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %% 
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %% 
17 %% %CopyrightEnd%
18 %%
19 %%
20 %%-----------------------------------------------------------------
21 %% File: tracer.erl
22 %% 
23 %% Description:
24 %%    This file contains an example of pre and post conditions for 
25 %%    the corba backend.
26 %%
27 %%-----------------------------------------------------------------
28 -module(tracer).
29 -include("m.hrl").
30 
31 %%-----------------------------------------------------------------
32 %% External exports
33 %%-----------------------------------------------------------------
34 -export([pre/3post/4]).
35 
36 %%-----------------------------------------------------------------
37 %% Internal exports
38 %%-----------------------------------------------------------------
39 -export([]).
40 
41 %%-----------------------------------------------------------------
42 %% External functions
43 %%-----------------------------------------------------------------
44 pre(MF[StateI]when is_integer(I->
45     io:format("Precond called in process ~p~s:~s() ~p\n"[self(), MF,  [StateI]]),
46     ok;
47 pre(_M_F_A-> %% Just an silly example to get an exception case
48     corba:raise(#'m_NotAnInteger'{}).
49 
50 post(MFAR->
51     io:format("Postcond called in process ~p~s:~s() ~p ~p\n"[self(), MFAR]),
52     ok.
53 
54 %%-----------------------------------------------------------------
55 %% Internal functions
56 %%-----------------------------------------------------------------
wirelike/dark
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
wirelike/light
https://github.com/erlang/otp/tree/master/lib/common_test/src/ct_util.hrl
 1 %%
 2 %% %CopyrightBegin%
 3 %%
 4 %% Copyright Ericsson AB 2003-2011. All Rights Reserved.
 5 %%
 6 %% The contents of this file are subject to the Erlang Public License,
 7 %% Version 1.1, (the "License"); you may not use this file except in
 8 %% compliance with the License. You should have received a copy of the
 9 %% Erlang Public License along with this software. If not, it can be
10 %% retrieved online at http://www.erlang.org/.
11 %%
12 %% Software distributed under the License is distributed on an "AS IS"
13 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 %% the License for the specific language governing rights and limitations
15 %% under the License.
16 %%
17 %% %CopyrightEnd%
18 %%
19 
20 -define(attr_table,ct_attributes).
21 -define(conn_table,ct_connections).
22 -define(board_table,ct_boards).
23 -define(suite_table,ct_suite_data).
24 
25 -record(conn{handle,
26          targetref,
27          address,
28          callback}).
29 
30 -record(testspec{spec_dir,
31              nodes=[],
32        init=[],
33        label=[],
34        logdir=["."],
35        cover=[],
36        config=[],
37        userconfig=[],
38        event_handler=[],
39        ct_hooks=[],
40        include=[],
41        multiply_timetraps=[],
42        scale_timetraps=[],
43        alias=[],
44        tests=[],
45        merge_tests = true }).
46 
47 -record(cover{app=none,
48     level=details,
49     excl_mods=[],
50     incl_mods=[],
51     cross=[],
52     src=[]}).
53 
54 -define(CT_EVMGRct_event).
55 -define(CT_EVMGR_REFct_event).
56 -define(CT_MEVMGRct_master_event).
57 -define(CT_MEVMGR_REFct_master_event).
58 
59 -define(missing_suites_info"missing_suites.info").
60 -define(ct_config_txtct_config_plain).
wirelike/dark
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
wirelike/light
https://github.com/yi-editor/yi/tree/master/yi/src/library/Yi/Boot.hs
 1 -- | Boot process of Yi, as an instanciation of Dyre
 2 module Yi.Boot (yi, yiDriver, reload) where
 3 
 4 import qualified Config.Dyre as Dyre
 5 import qualified Config.Dyre.Options as Dyre
 6 import Config.Dyre.Relaunch
 7 import Control.Monad.State
 8 import qualified Data.Rope as R
 9 import System.Directory
10 import System.Environment
11 import System.Exit
12 
13 import Yi.Config
14 import Yi.Editor
15 import Yi.Keymap
16 import Yi.Main
17 import qualified Yi.UI.Common as UI
18 
19 realMain :: (Config, ConsoleConfig) -> IO ()
20 realMain configs = do
21     editor <- restoreBinaryState Nothing
22     main configs editor
23 
24 showErrorsInConf :: (Config, ConsoleConfig) -> String -> (Config, ConsoleConfig)
25 showErrorsInConf (conf, confcon) errs
26     = (conf { initialActions = (makeAction $ splitE >> newBufferE (Left "*errors*") (R.fromString errs)) : initialActions conf }
27       , confcon)
28 
29 yi, yiDriver :: Config -> IO ()
30 yi = yiDriver
31 
32 yiDriver cfg = do
33     args <- Dyre.withDyreOptions Dyre.defaultParams getArgs 
34     -- we do the arg processing before dyre, so we can extract '--ghc-option=' and '--help' and so on.
35     case do_args cfg args of
36         Left (Err err code) ->
37           do putStrLn err
38              exitWith code
39         Right (finalCfg, cfgcon) -> 
40             let yiParams = Dyre.defaultParams
41                             { Dyre.projectName  = "yi"
42                             , Dyre.realMain     = realMain
43                             , Dyre.showError    = showErrorsInConf
44                             , Dyre.configDir    = Just . getAppUserDataDirectory $ "yi"
45                             , Dyre.hidePackages = ["mtl"]
46                             , Dyre.ghcOpts      = ["-threaded""-O2"++ ghcOptions cfgcon
47                             }
48             in Dyre.wrapMain yiParams (finalCfg, cfgcon)
49 
50 reload :: YiM ()
51 reload = do
52     editor <- withEditor get
53     withUI (\ui -> UI.end ui False)
54     liftIO $ relaunchWithBinaryState (Just editor) Nothing
55 
wirelike/dark
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
wirelike/light
https://github.com/Bukkit/Bukkit/tree/master/src/main/java/org/bukkit/command/PluginCommandYamlParser.java
 1 package org.bukkit.command;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 import java.util.Map;
 6 import java.util.Map.Entry;
 7 
 8 import org.bukkit.plugin.Plugin;
 9 
10 public class PluginCommandYamlParser {
11 
12     @SuppressWarnings("unchecked")
13     public static List<Command> parse(Plugin plugin) {
14         List<Command> pluginCmds = new ArrayList<Command>();
15         Object object = plugin.getDescription().getCommands();
16 
17         if (object == null) {
18             return pluginCmds;
19         }
20 
21         Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) object;
22 
23         if (map != null) {
24             for (Entry<String, Map<String, Object>> entry : map.entrySet()) {
25                 Command newCmd = new PluginCommand(entry.getKey(), plugin);
26                 Object description = entry.getValue().get("description");
27                 Object usage = entry.getValue().get("usage");
28                 Object aliases = entry.getValue().get("aliases");
29                 Object permission = entry.getValue().get("permission");
30 
31                 if (description != null) {
32                     newCmd.setDescription(description.toString());
33                 }
34 
35                 if (usage != null) {
36                     newCmd.setUsage(usage.toString());
37                 }
38 
39                 if (aliases != null) {
40                     List<String> aliasList = new ArrayList<String>();
41 
42                     if (aliases instanceof List) {
43                         for (Object o : (List<Object>) aliases) {
44                             aliasList.add(o.toString());
45                         }
46                     } else {
47                         aliasList.add(aliases.toString());
48                     }
49 
50                     newCmd.setAliases(aliasList);
51                 }
52 
53                 if (permission != null) {
54                     newCmd.setPermission(permission.toString());
55                 }
56 
57                 pluginCmds.add(newCmd);
58             }
59         }
60         return pluginCmds;
61     }
62 }
wirelike/dark
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
wirelike/light
https://github.com/joyent/node/tree/master/deps/v8/test/mjsunit/regress/regress-arguments-gc.js
 1 // Copyright 2011 the V8 project authors. All rights reserved.
 2 // Redistribution and use in source and binary forms, with or without
 3 // modification, are permitted provided that the following conditions are
 4 // met:
 5 //
 6 //     * Redistributions of source code must retain the above copyright
 7 //       notice, this list of conditions and the following disclaimer.
 8 //     * Redistributions in binary form must reproduce the above
 9 //       copyright notice, this list of conditions and the following
10 //       disclaimer in the documentation and/or other materials provided
11 //       with the distribution.
12 //     * Neither the name of Google Inc. nor the names of its
13 //       contributors may be used to endorse or promote products derived
14 //       from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 // Flags: --expose-gc --nocleanup_code_caches_at_gc
29 
30 function f(x) {
31   gc();
32   arguments[0] = {};
33 }
34 
35 f(1);
36 f(1);
37 f(1);
wirelike/dark
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
wirelike/light
https://github.com/UPenn-RoboCup/UPennalizers/tree/master/Player/Config/Config_OP_Camera_Grasp.lua
 1 module(..., package.seeall);
 2 require('vector')
 3 --require('vcm')
 4 
 5 -- Camera Parameters
 6 
 7 camera = {};
 8 camera.ncamera = 1;
 9 camera.switchFreq = 0--unused for OP
10 camera.width = 640;
11 camera.height = 480;
12 camera.x_center = 328;
13 camera.y_center = 248;
14 
15 camera.focal_length = 533-- in pixels
16 camera.focal_base = 640-- image width used in focal length calculation
17 
18 --[[
19 queryctrl: "White Balance Temperature" 0x98091a
20 queryctrl: "Sharpness" 0x98091b
21 queryctrl: "Backlight Compensation" 0x98091c
22 queryctrl: "Exposure, Auto" 0x9a0901
23 querymenu: Auto Mode
24 querymenu: Manual Mode
25 querymenu: Shutter Priority Mode
26 querymenu: Aperture Priority Mode
27 queryctrl: "Exposure (Absolute)" 0x9a0902
28 queryctrl: "Exposure, Auto Priority" 0x9a0903
29 queryctrl: "Pan (Absolute)" 0x9a0908
30 queryctrl: "Tilt (Absolute)" 0x9a0909
31 queryctrl: "Brightness" 0x980900
32 queryctrl: "Contrast" 0x980901
33 queryctrl: "Saturation" 0x980902
34 queryctrl: "White Balance Temperature, Auto" 0x98090c
35 queryctrl: "Gain" 0x980913
36 queryctrl: "Power Line Frequency" 0x980918
37 --]]
38 
39 camera.auto_param = {};
40 camera.auto_param[1] = {key='exposure, auto',          val={0}};
41 camera.auto_param[2] = {key='white balance temperature, auto',     val={0}};
42 camera.auto_param[3] = {key='power line frequency',   val={0}};
43 camera.auto_param[4] = {key='backlight compensation', val={0}};
44 --camera.auto_param[5] = {key='autogain',               val={0}};
45 
46 
47 camera.param = {};
48 camera.param[1] = {key='brightness',    val={216}};
49 camera.param[2] = {key='contrast',      val={2}};
50 camera.param[3] = {key='saturation',    val={48}};
51 camera.param[4] = {key='gain',          val={255}};
52 camera.param[5] = {key='white balance temperature', val={1000}};
53 camera.param[6] = {key='sharpness',     val={0}};
54 camera.param[7] = {key='exposure (absolute)',      val={1005}};
55 
56 camera.lut_file = 'lut_low_contrast_pink_n_green.raw';
57 
wirelike/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
wirelike/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Sources/TTTableItem.m
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UI/TTTableItem.h"
18 
19 // Core
20 #import "Three20Core/TTCorePreprocessorMacros.h"
21 
22 
23 ///////////////////////////////////////////////////////////////////////////////////////////////////
24 ///////////////////////////////////////////////////////////////////////////////////////////////////
25 ///////////////////////////////////////////////////////////////////////////////////////////////////
26 @implementation TTTableItem
27 
28 @synthesize userInfo = _userInfo;
29 
30 
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32 (void)dealloc {
33   TT_RELEASE_SAFELY(_userInfo);
34 
35   [super dealloc];
36 }
37 
38 
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 #pragma mark -
42 #pragma mark NSCoding
43 
44 
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46 (id)initWithCoder:(NSCoder*)decoder {
47   self = [self init];
48   if (self) {
49   }
50 
51   return self;
52 }
53 
54 
55 ///////////////////////////////////////////////////////////////////////////////////////////////////
56 (void)encodeWithCoder:(NSCoder*)encoder {
57 }
58 
59 
60 @end
wirelike/dark
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
wirelike/light
https://github.com/facebook/three20/tree/master/src/Three20UI/Headers/TTViewController.h
 1 //
 2 // Copyright 2009-2011 Facebook
 3 //
 4 // Licensed under the Apache License, Version 2.0 (the "License");
 5 // you may not use this file except in compliance with the License.
 6 // You may obtain a copy of the License at
 7 //
 8 //    http://www.apache.org/licenses/LICENSE-2.0
 9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #import "Three20UINavigator/TTNavigatorViewController.h"
18 
19 @class TTTableViewController;
20 @class TTSearchDisplayController;
21 
22 /**
23  * A view controller with some useful additions.
24  */
25 @interface TTViewController : TTNavigatorViewController {
26 @protected
27   TTSearchDisplayController* _searchController;
28 }
29 
30 /**
31  * A view controller used to display the contents of the search display controller.
32  *
33  * If you assign a view controller to this property, it will automatically create a search
34  * display controller which you can access through this view controller's searchDisplaController
35  * property.  You can then take the searchBar from that controller and add it to your views. The
36  * search bar will then search the data source of the view controller that you assigned here.
37  */
38 @property (nonatomic, retain) TTTableViewController* searchViewController;
39 
40 /**
41  * Forcefully initiates garbage collection. You may call this in your didReceiveMemoryWarning
42  * message if you are worried about garbage collection memory consumption.
43  *
44  * See Articles/UI/GarbageCollection.mdown for a more detailed discussion.
45  */
46 (void)doGarbageCollection;
47 
48 @end
wirelike/dark
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
wirelike/light
https://github.com/mirrors/perl/tree/master/ext/XS-APItest/Makefile.PL
 1 use 5.008;
 2 use ExtUtils::MakeMaker;
 3 use ExtUtils::Constant 0.11 'WriteConstants';
 4 use Config;
 5 
 6 WriteMakefile(
 7     'NAME'    => 'XS::APItest',
 8     'VERSION_FROM'  => 'APItest.pm'# finds $VERSION
 9     'PREREQ_PM'   => {}, # e.g., Module::Name => 1.1
10     ABSTRACT_FROM => 'APItest.pm'# retrieve abstract from module
11     AUTHOR    => 'Tim Jenness <t.jenness@jach.hawaii.edu>, Christian Soeller <csoelle@mph.auckland.ac.nz>, Hugo van der Sanden <hv@crypt.compulink.co.uk>, Andrew Main (Zefram) <zefram@fysh.org>',
12     'C'                 => ['exception.c''core.c''notcore.c'],
13     'OBJECT'            => '$(BASEEXT)$(OBJ_EXT) XSUB-undef-XS_VERSION$(OBJ_EXT) XSUB-redefined-macros$(OBJ_EXT) $(O_FILES)',
14     realclean => {FILES => 'const-c.inc const-xs.inc'},
15     ($Config{gccversion} && $Config{d_attribute_deprecated} ?
16       (CCFLAGS => $Config{ccflags} . ' -Wno-deprecated-declarations') : ()),
17 );
18 
19 my @names = (qw(HV_DELETE HV_DISABLE_UVAR_XKEY HV_FETCH_ISSTORE
20     HV_FETCH_ISEXISTS HV_FETCH_LVALUE HV_FETCH_JUST_SV
21     G_SCALAR G_ARRAY G_VOID G_DISCARD G_EVAL G_NOARGS
22     G_KEEPERR G_NODEBUG G_METHOD G_FAKINGEVAL
23     IS_NUMBER_IN_UV IS_NUMBER_GREATER_THAN_UV_MAX
24     IS_NUMBER_NOT_INT IS_NUMBER_NEG IS_NUMBER_INFINITY
25     IS_NUMBER_NAN
26     ),
27        {name=>"G_WANT"default=>["IV""G_ARRAY|G_VOID"]});
28 
29 open my $fh'../../overload.h' or die "Can't open ../../overload.h: $!";
30 while (<$fh>) {
31     push @names, {name => $1macro => 1if /^\s+([A-Za-z_0-9]+_amg),/;
32 }
33 
34 WriteConstants(
35     PROXYSUBS => 1,
36     NAME => 'XS::APItest',
37     NAMES => \@names,
38          );
39 
40 sub MY::install "install ::\n"  };
wirelike/dark
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
wirelike/light
https://github.com/cakephp/cakephp/tree/master/cake/tests/fixtures/translated_article_fixture.php
 1 <?php
 2 /**
 3  * Short description for file.
 4  *
 5  * PHP versions 4 and 5
 6  *
 7  * CakePHP(tm) Tests <http://book.cakephp.org/view/1196/Testing>
 8  * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 9  *
10  *  Licensed under The Open Group Test Suite License
11  *  Redistributions of files must retain the above copyright notice.
12  *
13  * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
14  * @link          http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
15  * @package       cake
16  * @subpackage    cake.tests.fixtures
17  * @since         CakePHP(tm) v 1.2.0.5669
18  * @license       http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
19  */
20 
21 /**
22  * Short description for class.
23  *
24  * @package       cake
25  * @subpackage    cake.tests.fixtures
26  */
27 class TranslatedArticleFixture extends CakeTestFixture {
28 
29 /**
30  * name property
31  *
32  * @var string 'TranslatedItem'
33  * @access public
34  */
35   var $name = 'TranslatedArticle';
36 
37 /**
38  * fields property
39  *
40  * @var array
41  * @access public
42  */
43   var $fields = array(
44     'id=> array('type=> 'integer', 'key=> 'primary'),
45     'user_id=> array('type=> 'integer', 'null=> false),
46     'published=> array('type=> 'string', 'length=> 1, 'default=> 'N'),
47     'created=> 'datetime',
48     'updated=> 'datetime'
49   );
50 
51 /**
52  * records property
53  *
54  * @var array
55  * @access public
56  */
57   var $records = array(
58     array('id=> 1, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:39:23', 'updated=> '2007-03-18 10:41:31'),
59     array('id=> 2, 'user_id=> 3, 'published=> 'Y', 'created=> '2007-03-18 10:41:23', 'updated=> '2007-03-18 10:43:31'),
60     array('id=> 3, 'user_id=> 1, 'published=> 'Y', 'created=> '2007-03-18 10:43:23', 'updated=> '2007-03-18 10:45:31')
61   );
62 }
wirelike/dark
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
wirelike/light
https://github.com/django/django/tree/master/django/core/management/commands/startproject.py
 1 from django.core.management.base import copy_helper, CommandError, LabelCommand
 2 from django.utils.importlib import import_module
 3 import os
 4 import re
 5 from random import choice
 6 
 7 class Command(LabelCommand):
 8     help = "Creates a Django project directory structure for the given project name in the current directory."
 9     args = "[projectname]"
10     label = 'project name'
11 
12     requires_model_validation = False
13     # Can't import settings during this command, because they haven't
14     # necessarily been created.
15     can_import_settings = False
16 
17     def handle_label(self, project_name, **options):
18         # Determine the project_name a bit naively -- by looking at the name of
19         # the parent directory.
20         directory = os.getcwd()
21 
22         # Check that the project_name cannot be imported.
23         try:
24             import_module(project_name)
25         except ImportError:
26             pass
27         else:
28             raise CommandError("%r conflicts with the name of an existing Python module and cannot be used as a project name. Please try another name." % project_name)
29 
30         copy_helper(self.style, 'project', project_name, directory)
31 
32         # Create a random SECRET_KEY hash, and put it in the main settings.
33         main_settings_file = os.path.join(directory, project_name, 'settings.py')
34         settings_contents = open(main_settings_file, 'r').read()
35         fp = open(main_settings_file, 'w')
36         secret_key = ''.join([choice('abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'for i in range(50)])
37         settings_contents = re.sub(r"(?<=SECRET_KEY = ')'", secret_key + "'", settings_contents)
38         fp.write(settings_contents)
39         fp.close()
wirelike/dark
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
wirelike/light
https://github.com/rails/rails/tree/master/actionpack/lib/action_dispatch/middleware/remote_ip.rb
 1 module ActionDispatch
 2   class RemoteIp
 3     class IpSpoofAttackError < StandardError ; end
 4 
 5     class RemoteIpGetter
 6       def initialize(env, check_ip_spoofing, trusted_proxies)
 7         @env = env
 8         @check_ip_spoofing = check_ip_spoofing
 9         @trusted_proxies = trusted_proxies
10       end
11 
12       def remote_addrs
13         @remote_addrs ||= begin
14           list = @env['REMOTE_ADDR'] ? @env['REMOTE_ADDR'].split(/[,\s]+/) : []
15           list.reject { |addr| addr =~ @trusted_proxies }
16         end
17       end
18 
19       def to_s
20         return remote_addrs.first if remote_addrs.any?
21 
22         forwarded_ips = @env['HTTP_X_FORWARDED_FOR'] ? @env['HTTP_X_FORWARDED_FOR'].strip.split(/[,\s]+/) : []
23 
24         if client_ip = @env['HTTP_CLIENT_IP']
25           if @check_ip_spoofing && !forwarded_ips.include?(client_ip)
26             # We don't know which came from the proxy, and which from the user
27             raise IpSpoofAttackError"IP spoofing attack?!" \
28               "HTTP_CLIENT_IP=#{@env['HTTP_CLIENT_IP'].inspect}" \
29               "HTTP_X_FORWARDED_FOR=#{@env['HTTP_X_FORWARDED_FOR'].inspect}"
30           end
31           return client_ip
32         end
33 
34         return forwarded_ips.reject { |ip| ip =~ @trusted_proxies }.last || @env["REMOTE_ADDR"]
35       end
36     end
37 
38     def initialize(app, check_ip_spoofing = true, trusted_proxies = nil)
39       @app = app
40       @check_ip_spoofing = check_ip_spoofing
41       regex = '(^127\.0\.0\.1$|^(10|172\.(1[6-9]|2[0-9]|30|31)|192\.168)\.)'
42       regex << "|(#{trusted_proxies})" if trusted_proxies
43       @trusted_proxies = Regexp.new(regex, "i")
44     end
45 
46     def call(env)
47       env["action_dispatch.remote_ip"] = RemoteIpGetter.new(env, @check_ip_spoofing@trusted_proxies)
48       @app.call(env)
49     end
50   end
51 end
wirelike/dark
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
wirelike/light
https://github.com/n8han/Unfiltered/tree/master/agents/src/test/scala/AgentSpec.scala
 1 package unfiltered.request
 2 
 3 import test.AgentStrings
 4 import org.specs._
 5 
 6 object AgentSpecJetty
 7 extends unfiltered.spec.jetty.Planned
 8 with AgentSpec
 9 
10 object AgentSpecNetty
11 extends unfiltered.spec.netty.Planned
12 with AgentSpec
13 
14 trait AgentSpec extends unfiltered.spec.Hosted {
15   import unfiltered.response._
16   import unfiltered.request._
17   import unfiltered.request.{Path => UFPath}
18 
19   import dispatch._
20 
21   def intent[A,B]: unfiltered.Cycle.Intent[A,B] = {
22     case GET(_) & AgentIs.Chrome(_) => ResponseString("chromium")
23     case GET(_) & AgentIs.Safari(_) & AgentIs.Mobile(_) => ResponseString("safari mobile")
24     case GET(_) & AgentIs.Safari(_) => ResponseString("safari")
25     case GET(_) & AgentIs.FireFox(_) => ResponseString("firefox")
26     case GET(_) & AgentIs.IE(_) => ResponseString("ie")
27   }
28 
29   "AgentIs should" should {
30     "match chrome" in {
31       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.chrome.head) as_str)
32       resp must_=="chromium"
33     }
34     "match safari" in {
35       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.safari.head) as_str)
36       resp must_=="safari"
37     }
38     "match mobile safari" in {
39       val resp = http(host / "test" <:< Map("User-Agent" -> "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B5097d Safari/6531.22.7") as_str)
40       resp must_=="safari mobile"
41     }
42     "match firefox" in {
43       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.firefox.head)  as_str)
44       resp must_=="firefox"
45     }
46     "match ie" in {
47       val resp = http(host / "test" <:< Map("User-Agent" -> AgentStrings.ie.head)  as_str)
48       resp must_=="ie"
49     }
50   }
51 }
wirelike/dark
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
wirelike/light
https://github.com/jimweirich/sicp-study/tree/master/scheme/chapter1/ex1_32.scm
 1 ;; SICP 1.32
 2 
 3 ;; Exercise 1.32.  a. Show that sum and product (exercise 1.31) are
 4 ;; both special cases of a still more general notion called accumulate
 5 ;; that combines a collection of terms, using some general
 6 ;; accumulation function:
 7 
 8 ;; (accumulate combiner null-value term a next b)
 9 
10 ;; Accumulate takes as arguments the same term and range
11 ;; specifications as sum and product, together with a combiner
12 ;; procedure (of two arguments) that specifies how the current term is
13 ;; to be combined with the accumulation of the preceding terms and a
14 ;; null-value that specifies what base value to use when the terms run
15 ;; out. Write accumulate and show how sum and product can both be
16 ;; defined as simple calls to accumulate.
17 
18 ;; b. If your accumulate procedure generates a recursive process,
19 ;; write one that generates an iterative process. If it generates an
20 ;; iterative process, write one that generates a recursive process.
21 
22 ;; ANSWER ------------------------------------------------------------
23 
24 (define (accumulate combiner null-value term a next b)
25   (cond ((> a b) null-value)
26         (else (combiner (term a)
27                         (accumulate combiner null-value term (next a) next b)))))
28 
29 
30 ;; And now the iterative version
31 
32 (define (accumulate combiner null-value term a next b)
33   (define (iter a result)
34     (if (> a b)
35         result
36         (iter (next a) (combiner (term a) result))))
37   (iter a null-value))
38 
39 ;; And this is how you would write product and sum in terms of
40 ;; accumulate.
41 
42 (define (product term a next b)
43   (accumulate * 1 term a next b))
44 
45 (define (sum term a next b)
46   (accumulate + 0 term a next b))
47 
48 ;;
wirelike/dark
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))
wirelike/light
https://github.com/higepon/mosh/tree/master/misc/scripts/only-maker.ss
 1 (import (rnrs)
 2         (mosh)
 3         (mosh process))
 4 
 5 ; ./mosh scripts/only-maker.ss lib/match.ss "\(only "  
 6 
 7 ;; Read file, find (only (...) ...) and replace it to (only (...) ... sym)
 8 (define (add-only-sym! file regex sym)
 9   (let ([lst (map (lambda (line)
10        (if (regex line)
11            (call-with-port (open-string-input-port line)
12              (lambda (p)
13                (let ([only* (read p)])
14                  (cond
15                   [(and (pair? only*) (>= (length only*) 2))
16                    (cons* (car only*) (cadr only*) (append (cddr only*) (list sym)))]
17                   [else
18                    (error 'add-symbol "malformed (only)")]))))
19            line))
20                   (file->list file))])
21     (with-output-to-file file
22       (lambda ()
23         (for-each print lst)))))
24 
25 (define (spawn->string cmd)
26   (let-values ([(in out) (pipe)])
27     (define (port->string p)
28       (let loop ([ret '()][(read-char p)])
29         (if (eof-object? c)
30             (list->string (reverse ret))
31             (loop (cons c ret) (read-char p)))))
32     (let-values ([(pid cin cout cerr) (spawn cmd '() (list #f out #f))])
33       (close-port out)
34       (let ([(port->string (transcoded-port in (make-transcoder (utf-8-codec))))])
35         (close-port in)
36         (waitpid pid)
37         x))))
38 
39 (define (chop s)
40   (substring s 0 (- (string-length s) 1)))
41 
42 (define (main args)
43   (let loop ([unbound-sym (spawn->string "./scripts/only.sh")])
44     (if (string=? "" unbound-sym)
45         '()
46         (begin (add-only-sym! (cadr args) (string->regexp (caddr args)) (string->symbol (chop unbound-sym)))
47                (loop (spawn->string "./scripts/only.sh"))))))
48 
49 (main (command-line))